package homework.homework2;

public class Builder implements CarBulider {
    Car car = new Car();

    @Override
    public void buildEngine() {
        Engine e = new Engine();
        e.setId(1);
        e.setType("普通发动机");
        car.setEngine(e);
        System.out.println("创建发动机.....");
    }

    @Override
    public void buildWheel() {
        Wheel w = new Wheel();
        w.setSize("30");
        car.setWheel(w);
        System.out.println("创建了方向盘");
    }

    @Override
    public void buildCarWheel() {
        CarWheel carWheel = new CarWheel();
        carWheel.setSize("30");
        car.setCarWheel(carWheel);
        System.out.println("创建了四个轮子");
    }

    @Override
    public void buildCarBody() {
        CarBody carBody = new CarBody();
        carBody.setName("奔驰");
        car.setCarBody(carBody);
        System.out.println("创建了车身");
    }

    @Override
    public void buildPaintCar() {
        PaintCar paintCar = new PaintCar();
        paintCar.setColor("red");
        car.setPaintCar(paintCar);
    }

    @Override
    public Car bulieCar() {
        System.out.println("创建了汽车");
        return car;
    }
}
